Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dracut.sh): --sysroot option broken if global variables not set in conf #2155

Merged

Conversation

aafeijoo-suse
Copy link
Member

When $dracutsysrootdir is set and references an existing directory, the internal global variables are never set, unless their value is assigned via configuration file (first reported in stalled PR #1975).

The simple fix would be turn all:

[[ -d $dracutsysrootdir$var ]] || var=value

into:

[[ -z $var || ! -d $dracutsysrootdir$var ]] && var=value

But this patch also includes a refactoring, removing duplicate code using the same set_global_var function to set and export global variables, and improving readability.

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

…n conf

When `$dracutsysrootdir` is set and references an existing directory, the
internal global variables are never set, unless their value is assigned via
configuration file.

The simple fix would be turn all:

```
[[ -d $dracutsysrootdir$var ]] || var=value
```
into:
```
[[ -z $var || ! -d $dracutsysrootdir$var ]] && var=value
```

But this patch also includes a refactoring, removing duplicate code using the
same `set_global_var` function to set and export global variables, and improving
readability.
Copy link
Collaborator

@johannbg johannbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup

@stale
Copy link

stale bot commented Feb 2, 2023

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

@stale stale bot added the stale communication is stuck label Feb 2, 2023
Copy link
Collaborator

@LaszloGombos LaszloGombos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stale stale bot removed the stale communication is stuck label Feb 2, 2023
@aafeijoo-suse aafeijoo-suse merged commit 6f4a5c9 into dracutdevs:master Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants